Scheduler for WinRT
Step 3 of 4: Adding Code

In this step, you'll add code for the Button_Click events.

  1. Add the following namespace at the top of the page:
C#
Copy Code
using C1.Xaml.Schedule;
  1. Edit the MainPage() constructor so that it resembles the following:
C#
Copy Code
public MainPage()
{
    this.Unloaded += MainPage_Unloaded;
    this.InitializeComponent();
    sched1.Settings.FirstVisibleTime = System.TimeSpan.FromHours(8);
}
  1. Add the following code below the MainPage() constructor. The code adds a Click event for each button: 
C#
Copy Code
void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
    // dispose C1Scheduler control to avoid memory leaks
    sched1.Dispose();
}
private void DayClick(object sender, RoutedEventArgs e)
{
    sched1.ChangeStyle(sched1.OneDayStyle);
}
private void WorkWeekClick(object sender, RoutedEventArgs e)
{
    sched1.ChangeStyle(sched1.WorkingWeekStyle);
}
private void WeekClick(object sender, RoutedEventArgs e)
{
    sched1.ChangeStyle(sched1.WeekStyle);
}
private void MonthClick(object sender, RoutedEventArgs e)
{
    sched1.ChangeStyle(sched1.MonthStyle);
}      

In this step you added code to control the Button_Click events. In the next step, you'll run your application.

See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback